package config

import (
	"github.com/spf13/viper"
	"inspector/pkg/log"
)

type LogConfig struct {
	Name              string   `mapstructure:"name"`
	Development       bool     `mapstructure:"development"`
	Level             string   `mapstructure:"level"`
	Format            string   `mapstructure:"format"`
	EnableColor       bool     `mapstructure:"enable-color"`
	DisableCaller     bool     `mapstructure:"disable-caller"`
	DisableStacktrace bool     `mapstructure:"disable-stacktrace"`
	OutputPaths       []string `mapstructure:"output-paths"`
	ErrorOutputPaths  []string `mapstructure:"error-output-paths"`
}

var logConfig LogConfig

func initLogConfig(v *viper.Viper) {
	err := v.Sub("log").Unmarshal(&logConfig)
	if err != nil {
		log.Error(err.Error())
	}
}

func (c *Config) GetLogConfig() LogConfig {
	return logConfig
}
